<?php
include_once('./inc/config.php');
$aw_code = $_POST['aw_code'];
//$site_details = $_POST['site_details'];

$query = "SELECT d_id
		FROM `domains`
		WHERE
		c_code = '".$dbobj->MySQLDB_Sanitize($aw_code)."'
		AND
		d_name like '".$dbobj->MySQLDB_Sanitize($_POST['location_host'])."'
		";
// Perform Query
$result = mysql_query($query);

// Gwet num rows from the result set	
$no_rows = mysql_num_rows($result);	
//echo '$query '.$query .'--- $no_rows '.$no_rows ;	
$status_msg = 0;
if($no_rows > 0 && isset($_POST['location_href']))
{
	$query = "INSERT INTO `analytics_data` (
	`an_id` ,
	`an_code` ,
	`an_created`,
	`br_code_name` ,
	`br_name` ,
	`br_version` ,
	`br_cookie_enb` ,
	`br_platform` ,
	`br_userAgent` ,
	`br_language` ,
	`br_product` ,
	`br_onLine` ,
	`br_vendor` ,
	`br_product_sub` ,
	`br_build_ID` ,
	`br_oscpu` ,
	`sc_top` ,
	`sc_height` ,
	`sc_width` ,
	`sc_left` ,
	`sc_pixelDepth` ,
	`sc_colorDepth` ,
	`sc_availWidth` ,
	`sc_availHeight` ,
	`sc_availLeft` ,
	`sc_availTop` ,
	`hs_length` ,
	`doc_ref`,
	`ip_add`,
	`location_href`,
	`location_protocol`,
	`location_host`,
	`location_pathname`,
	`page_visits`,
	`total_page_load_time`
	)
	VALUES (
	NULL , '".$dbobj->MySQLDB_Sanitize($aw_code)."','".date("Y-m-d H:i:s")."',
	
	'".$dbobj->MySQLDB_Sanitize($_POST['br_code_name'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_name'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_version'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_cookie_enb'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_platform'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_userAgent'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_language'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_product'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_onLine'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_vendor'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_product_sub'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_build_ID'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['br_oscpu'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_top'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_height'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_width'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_left'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_pixelDepth'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_colorDepth'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_availWidth'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_availHeight'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_availLeft'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['sc_availTop'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['hs_length'])."' ,
	'".$dbobj->MySQLDB_Sanitize($_POST['doc_ref'])."',
	'".$dbobj->MySQLDB_Sanitize($_SERVER['REMOTE_ADDR'])."',
	'".$dbobj->MySQLDB_Sanitize($_POST['location_href'])."',
	'".$dbobj->MySQLDB_Sanitize($_POST['location_protocol'])."',
	'".$dbobj->MySQLDB_Sanitize($_POST['location_host'])."',
	'".$dbobj->MySQLDB_Sanitize($_POST['location_pathname'])."',
	'".$dbobj->MySQLDB_Sanitize($_POST['page_visits'])."',
	'".$dbobj->MySQLDB_Sanitize($_POST['total_page_load_time'])."'
	)";
	//echo 'Insert>>'.$query;
	
	$result = mysql_query($query);		
	$status_msg = 1;//success
}

echo $status_msg;
?>